package com.ruben.simplescaffold.manager.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.ruben.simplescaffold.manager.JsonManager;
import org.springframework.stereotype.Service;

/**
 * Json转换管理层实现类
 *
 * @author <achao1441470436@gmail.com>
 * @since 2021/7/7 11:13
 */
@Service
public class JsonManagerImpl implements JsonManager {
    /**
     * 序列化处理精度丢失
     *
     * @param serializeObj 将要序列化的对象
     * @return java.lang.Object
     * @author <achao1441470436@gmail.com>
     * @since 2021/7/7 11:16
     */
    @Override
    public Object browserCompatible(Object serializeObj) {
        return JSON.parse(JSON.toJSONString(serializeObj, SerializerFeature.BrowserCompatible));
    }
}
